import request from '@/utils/request'
import { AxiosPromise } from 'axios'
/**
 * 课时内容api
 */

export interface CreateOrUpdateLessonType {
    id?: number | null
    courseId?: number| string | null
    sectionId: number | null
    courseName?: string
    theme?: string
    duration: number | null
    isFree: boolean
    orderNum?: number
    status?: number
}

const createOrUpdateLesson = (data: CreateOrUpdateLessonType): AxiosPromise<any> => {
  return request({
    method: 'POST',
    url: '/boss/course/lesson/saveOrUpdate',
    data
  })
}

const getLessonById = (lessonId: number): AxiosPromise<any> => {
  return request({
    method: 'GET',
    url: '/boss/course/lesson/getById',
    params: {
      lessonId
    }
  })
}

export {
  createOrUpdateLesson,
  getLessonById
}
